package com.yn.front.controller;


import com.yn.common.model.article.ArticleContent;
import com.yn.common.page.BasePage;
import com.yn.common.request.sc.ArticleTransitRequest;
import com.yn.common.request.sc.ArticleTransitSearchRequest;
import com.yn.common.request.sc.PageParamRequest;
import com.yn.common.response.sc.BaseResult;
import com.yn.common.response.zy.DictResponse;
import com.yn.common.vo.ArticleInfoVO;
import com.yn.common.vo.ArticleTransitVO;
import com.yn.service.service.IArticleContentService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.validation.constraints.NotNull;
import java.util.List;

/**
 * <p>
 * 文章内容(科研服务) 前端控制器
 * </p>
 *
 * @author xuquanjun
 * @since 2025-06-26
 */
@RestController
@RequestMapping("api/articleContent")
@Api(tags = "转运文章内容(科研服务)——用户端")
public class ArticleContentController {
    @Autowired
    private IArticleContentService articleContentService;


    /**
     * 分页显示文章管理表
     * @param request ArticleSearchRequest 搜索条件
     * @param pageParamRequest 分页参数
     */
    @ApiOperation(value = "分页列表")
    @RequestMapping(value = "/list", method = RequestMethod.GET)
    @ApiImplicitParam(name="keywords", value="搜索关键字")
    public BaseResult<BasePage<ArticleTransitVO>> getList(ArticleTransitSearchRequest request,
                                                          PageParamRequest pageParamRequest) {
        return BaseResult.success(BasePage.restPage(articleContentService.getAdminList(request, pageParamRequest)));
    }

    /**
     * 查询文章转运详情
     * @param id Integer
     */
    @ApiOperation(value = "详情")
    @RequestMapping(value = "/info", method = RequestMethod.GET)
    @ApiImplicitParam(name="id", value="文章ID")
    public BaseResult<ArticleInfoVO> info(@RequestParam(value = "id") @NotNull Long id) {
        return BaseResult.success(articleContentService.getDetail(id));
    }


}
